<?php
/**
 * @author Laurent SITTLER <lolo.sittler@gmail.com>
 * @author Alexandre GOMEZ <gomez.alexandre02@gmail.com>
 * @version 0.1
 */
require_once 'Rule.php';
require_once 'Type.php';
require_once 'User.php';
/**
 * DB Class
 */
class DB {

    /**
     * Constructor
     */
    function __construct() {
        $this->m_id = 0;
        $this->m_nickname = NULL;
        $this->m_port = 0;
        $this->m_name = NULL;
        $this->m_type = 0;
        $this->m_user = 0;
        $this->m_rule = 0;
        $this->m_login = NULL;
        $this->m_password = NULL;
    }
    
    /**
     * Set attributs object
     * @param Integer $id
     * @param String $nnm
     * @param String $host
     * @param Integer $port
     * @param String $dbname
     * @param Integer $type
     * @param Integer $user
     * @param Integer $rule
     */
    public function SetDB($id, $nnm, $host, $port, $dbname, $type, $user, $rule){
        $this->m_id = $id;
        $this->m_nickname = $nnm;
        $this->m_host = $host;
        $this->m_port = $port;
        $this->m_name = $dbname;
        $this->m_type = $type;
        $this->m_user = $user;
        $this->m_rule = $rule;
    }


    /**
     * Get ID
     * @return Integer
     */
    public function GetID(){
        return $this->m_id;
    }
    
    /**
     * Get Nickname
     * @return String
     */
    public function GetNickname(){
        return $this->m_nickname;
    }

    /**
     * Get Host
     * @return String
     */
    public function GetHost(){
        return $this->m_host;
    }
    
    /**
     * Get Port
     * @return Integer
     */
    public function GetPort(){
        return $this->m_port;
    }
    
    /**
     * Get database name
     * @return String
     */
    public function GetName(){
        return $this->m_name;
    }
    
    /**
     * Set DB Name
     * @param String $dbname
     */
    public function SetName($dbname){
        $this->m_name = $dbname;
    }

    /**
     * Get Type
     * @return Type
     */
    public function GetType(){
        $getType = new Database_Model();
        return $getType->GetTypeByID($this->m_type);
    }
    
    /**
     * Get User database
     * @return User
     */
    public function GetUser(){
        return $this->m_user;
    }
    
    /**
     * Get Rule
     * @return Rule
     */
    public function GetRule(){
        $getRule = new Database_Model();
        return $getRule->GetRuleByID($this->m_rule);
    }
    
    /**
     * Get Login Database
     * @return String
     */
    public function GetLogin(){
        return $this->m_login;
    }
    
    /**
     * Get Password Database
     * @return String
     */
    public function GetPassword(){
        return $this->m_password;
    }
    
    /**
     * Set Login Database
     * @param String $login
     */
    public function SetLogin($login){
        $this->m_login = $login;
    }
    
    /**
     * Set Password Database
     * @param String $password
     */
    public function SetPassword($password){
        $this->m_password = $password;
    }

    /**
     * ID
     * @var Integer
     */
    private $m_id;
    
    /**
     * Nickname
     * @var String 
     */
    private $m_nickname;
    
    /**
     * Host
     * @var String
     */
    private $m_host;
    
    /**
     * Port
     * @var Integer
     */
   private $m_port;
   
   /**
    * Database name
    * @var String
    */
   private $m_name;
   
   /**
    * Type ID
    * @var Integer
    */
   private $m_type;
   
   /**
    * User ID
    * @var Integer
    */
   private $m_user;
   
   /**
    * Rule ID
    * @var Integer
    */
   private $m_rule;
   
   /**
    * Login
    * @var String
    */
   private $m_login;
   
   /**
    * Password
    * @var String
    */
   private $m_password;
    
}